/* @(#)GSProviderScanQueryAction.java    
*
* Project: BUS
*
* Modify Information:
* =============================================================================
*   Author       Date       Description
*   ------------ ---------- ---------------------------------------------------
*   Jenny Li     2006-2-11    新增
*
* Copyright Notice:
* =============================================================================
*    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
*        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
*        Haidian District, Beijing ,100081, China All rights reserved.
*
*    This software is the confidential and proprietary information of
*        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
*        You shall not disclose such Confidential Information and shall use it
*        only in accordance with the terms of the license agreement you entered
*        into with HiTRUST.
*
* Warning:
* =============================================================================
* 
*/
package com.hitrust.gs.action;

import java.util.ArrayList;

import com.hitrust.gs.bean.GSProviderBean;
import com.hitrust.gs.business.GSProviderProcessor;
import com.hitrust.gs.form.GSProviderScanQueryForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.service.GSBaseManager;
import com.hitrust.gs.util.exception.GSException;
import com.hitrust.gs.util.page.ResultProcess;

public class GSProviderScanQueryToManufactureAction extends GSBaseAction {

    public String execute(GSBaseForm aForm) throws Exception {
        
        GSProviderScanQueryForm tForm = (GSProviderScanQueryForm)aForm;
        //取得页面参数组成Bean对象
        GSProviderBean tGSProviderBean = new GSProviderBean();
        tGSProviderBean.setGs_provider_id(tForm.getProviderId());
        tGSProviderBean.setGs_provider_name(tForm.getProviderName());
        tGSProviderBean.setGs_reside_country(tForm.getCountryCode());
        tGSProviderBean.setGs_reside_province(tForm.getProvinceCode());
        tGSProviderBean.setGs_reside_city(tForm.getDistrictCode());
        tGSProviderBean.setGs_corp_property(tForm.getCorpProperty());
        
        //如果从细节页面返回，则取原来的查询条件
        if("T".equals(aForm.getRequest().getParameter("requery"))){
            tGSProviderBean = (GSProviderBean)aForm.getSession().getAttribute("providerquerybean");
        }
        
        aForm.getSession().setAttribute("providerquerybean",tGSProviderBean);
        
        try{
            //查询供应商
            GSProviderProcessor tGSProviderProcesser = new GSProviderProcessor();
            ResultProcess tRp = tGSProviderProcesser.getProviderByOpt(tGSProviderBean);
            tForm.getRequest().setAttribute("provider",tRp);
            
            //取得所有国家
            ArrayList tList = GSBaseManager.getAllCountry();
            aForm.getRequest().setAttribute("country",tList);
            //取得所有省
            tList = GSBaseManager.getAllProvince();
            aForm.getRequest().setAttribute("province",tList);
            //取得所有地区
            tList = GSBaseManager.getAllDistinct();
            aForm.getRequest().setAttribute("district",tList);
            //取得公司性质
            String[][] tStr= GSBaseManager.getAllCorpProperty();
            aForm.getRequest().setAttribute("corpproperty",tStr);
            
            //暂时用此方法传递分页参数
            tForm.getRequest().setAttribute("choice",tForm.getRequest().getParameter("choice"));
        }catch(GSException e){
            aForm.getRequest().setAttribute("action", "A100107.do");
            throw e;
        }
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
